#!/bin/bash

#generate a file include all students name
cat >stu_name.txt <<EOF
zhouchang
liwen
zhaowei
zengfenghua
yiguowen
wanda
tangqingyu
liaobingbing
huqianshen
caoyong
chenxingming
hubiwu
xianglingbo
zhangshuai
liqiang
wangtao
sunqiang
cali
EOF

#create an array store all students name

students_name=(`cat stu_name.txt`)
while :
do

#get a random number
students_c=${#students_name[@]}
if (( $students_c > 0 ))
then
	lucky_num=$(($RANDOM%$students_c))
	echo -e "please  \e[31m${students_name[lucky_num]}\e[0m answer teacher feng's question"
read
	unset students_name[lucky_num]
	students_name=($(echo ${students_name[@]}))
else
	echo "选完了"
	echo "回车从新开始"
	read
	students_name=(`cat stu_name.txt`)

fi
done

